<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>vue5 自定义指令</title>
	</head>
	<body>
		<div id="demo1">
			<p v-color="red">define</p>
			<p v-color="blue">1111</p>
			<p v-color="yellow">define the name</p>
			
		</div>
	</body>
</html>
<script src="js/vue.js"></script>
<script type="text/javascript">
	// function 匿名函数传参
	Vue.directive("color",function(args,color){
		args.style.background=color.expression;		//color 接收P整个对象表达式
	});
	
	new Vue({
		el:"#demo1",
		data:{
			// r:'red',
			// b:'blue',
			// y:'yellow'
		}
	});
</script>